home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / CAPTURES / CAPTUREA.C next >
Text File  |  1990-02-12  |  2KB  |  93 lines

  1. /* Capture program - example of serial port control
  2. *
  3. *  Programmer:        James R. Logan Jr.
  4. *  Organization:    Brigham Young University
  5. */
  6.  
  7. #include "QuickDraw.h"
  8. #include "MacTypes.h"
  9. #include "WindowMgr.h"
  10. #include "TextEdit.h"
  11. #include "ControlMgr.h"
  12. #include "EventMgr.h"
  13.  
  14. #include "capture.h"
  15.  
  16. extern WindowPtr
  17.   whichwindow,  /* Working variable to test which window is the frontmost */
  18.   noticeWindow; /* Window for copyright notice */
  19.  
  20. extern WindowRecord
  21.   nrecord;    /* Window record for copyright notice */
  22.  
  23. static char *notice = "\p Capture V1.1\rCopyright ⌐ 1989,1990\r  Brigham Young University\r";
  24.  
  25. static char *developercredit = 
  26. "\pCaptures data from a serial port.\r\
  27. An example of serial port control.\r";
  28.  
  29. static char *notice2 = 
  30. "\pYou may use this application and its source\r\
  31. for any purpose if credit is given given to the\r\
  32. developer and Brigham Young University\r\
  33. Computer Science Department\r\
  34. Provo, Utah 84602\r\
  35. (801) 378-3027";
  36.  
  37. static char *cost = 
  38. "\pDeveloper:  James R. Logan Jr.\r\
  39. Portions Copyrighted by Think Technologies.";
  40.  
  41.  
  42. /* Wait here for mouseDown event */
  43.  
  44. WaitForButton() {    
  45. EventRecord event;
  46.   do {
  47.     SystemTask();
  48.     GetNextEvent(everyEvent, &event);
  49.   }
  50.   while ((event.what != mouseDown) && (event.what != keyDown));
  51. }
  52.  
  53.  
  54. /* Do "About Capture" copyright notice */
  55.  
  56. DoAbout(g) screen *g; { 
  57. Rect     sRect,box;
  58.  
  59. GrafPtr tempPort;
  60.  
  61.   GetPort(&tempPort);
  62.   ShowWindow(    noticeWindow);
  63.   SelectWindow(    noticeWindow);
  64.   SetPort(        noticeWindow);
  65.   SetRect(&sRect,0,0,400,500);
  66.   EraseRect( &sRect);
  67.  
  68.       MoveTo(0,20);
  69.       TextSize(12); TextFace(0); TextFont(0);
  70.     SetRect(&box, 0, 5, 232, 100);
  71.     OffsetRect(&box, 10, 10);
  72.  
  73.     TextBox( ¬ice[1], notice[0], &box ,teJustCenter);
  74.  
  75.     OffsetRect(&box, 0, 58);
  76.     TextBox(&developercredit[1], developercredit[0], &box, teJustCenter);
  77.  
  78.     OffsetRect(&box, 0, 40);
  79.     TextFace(0); TextFont(geneva); TextSize(9);
  80.     TextBox(¬ice2[1], (unsigned char) notice2[0], &box, teJustCenter);
  81.  
  82.     OffsetRect(&box, 0, 82);
  83.     TextFace(0); TextFont(geneva); TextSize(9);
  84.  
  85.     TextBox( &cost[1], (unsigned char) cost[0], &box, teJustCenter);
  86.  
  87.     WaitForButton();
  88.  
  89.         SetPort(tempPort);
  90.  
  91.     HideWindow(noticeWindow);
  92. }
  93.